#include<iostream>
#include<vector>
#include<set>
using namespace std;
int main()
{
    string s;cin>>s;int len = s.size();
    int k;cin>>k;
    set<string> set;
    for(int i =1;i<=k;i++)
    {
        for(int begin = 0;begin<len-i;begin++)
        {
            int end = begin+i;
            string tmp = s.substr(begin,i);
            set.insert(tmp);
            if(set.size() == k+1)
                set.erase(--set.end());
        }
    }
    string ret = *(--set.end());
    cout<<ret<<endl;
    return 0;
}